var netcore = require('../../../utils/network.js')
var tripleDes = require('../../../utils/CKCrypto.js')
var comm = require('../../../utils/comm_util.js')
function getOrderList(pageIndex,callBack){
  var map=new Map()
  map.set("orderPayType", "1");
  map.set("currentPage", pageIndex);
  map.set("pageSize", 10);
  netcore.requestPost("order/getOrderLists.do", map, function (success) {
    success.forEach(function(item,index){
      item.orderNo = tripleDes.deCode(item.orderNo + "")
      item.orderIcon = tripleDes.deCode(item.orderIcon + "")
      item.orderTitle = tripleDes.deCode(item.orderTitle + "")
      item.orderAmount = tripleDes.deCode(item.orderAmount + "")
      // item.orderTime = comm.formatDate(Number(tripleDes.deCode(item.orderTime + "")))
      item.snapshots = tripleDes.deCode(item.snapshots + "")
      item.orderStatus = tripleDes.deCode(item.orderStatus + "")
      item.orderDiscountAmount = tripleDes.deCode(item.orderDiscountAmount + "")
      item.orderPayType = tripleDes.deCode(item.orderPayType + "")
      item.orderValidityDate = comm.formatDateInDay(Number(tripleDes.deCode(item.orderValidityDate + "")))
      item.orderGoodsId = tripleDes.deCode(item.orderGoodsId + "")
    })
    callBack(success)
  }, function (errorCode, errMsg) {
    wx.showToast({
      title: errMsg,
      icon: 'none',
    })
  })
}
module.exports = {
  getOrderList: getOrderList
}